home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 6 / FM Towns Free Software Collection 6.iso / ms_dos / cd_lib / src / cdr_rest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-08  |  683 b   |  37 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <dos.h>
  4. #include "define.h"
  5.  
  6. #ifdef DEBUG
  7. main()
  8. {
  9.     printf("return is %d\n", cdr_restore(0));
  10. }
  11. #endif
  12.  
  13. /* シリンダー0へのシーク */
  14. /*
  15.  * decice_no:   device number (Towns CD-ROM -> 0)
  16.  * return: 0 -> 正常終了, 0以外 -> エラー
  17.  */
  18. int cdr_restore(int device_no)
  19. {
  20.     union REGS reg;
  21.     
  22.     reg.h.ah = 0x03;
  23.     reg.h.al = (0xC0 | (u_char) device_no);
  24.     reg.x.cx = 0x0000;
  25.     
  26.     int86(0x93, ®, ®);
  27.     
  28.     if (reg.h.ah == 0) {
  29.         return 0;
  30.     } else if (reg.h.ah == 0x02) { /* device number error */
  31.         return DEVERR;
  32.     } else {                       /* (reg.h.ah == 0x80) hard ware error */
  33.         return reg.x.cx;
  34.     }
  35. }
  36.  
  37.